﻿using FreeSql.DataAnnotations;
using Jumei.Common.BaseModel;
using Jumei.Model.Business.GoodsManage;
using System;

namespace Jumei.Model.Business.OrdersManage
{
    /// <summary>
    /// 订单商品表
    /// </summary>
    [Table(Name = "or_order_goods")]
    [Index("idx_{tablename}_01", nameof(OrdersId), false)]
    [Index("idx_{tablename}_01", nameof(GoodsName), false)]
    public class OrderGoodsEntity : EntityFull, ITenant
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Column(Position = -10)]
        public long? TenantId { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long OrdersId { get; set; }

        public OrdersEntity Orders { get; set; }

        /// <summary>
        /// 商品ID
        /// </summary>
        public long GoodsId { get; set; }

        public GoodsEntity Goods { get; set; }

        /// <summary>
        /// 商品数量
        /// </summary>
        public int GoodsNum { get; set; }

        /// <summary>
        /// 商品价格
        /// </summary>
        public decimal GoodsPrice { get; set; }

        /// <summary>
        /// 商品-规格ID
        /// </summary>
        public long GoodsSpecId { get; set; }

        public GoodsScoresEntity GoodsSpec { get; set; }

        /// <summary>
        /// 商品-规格值列表
        /// </summary>
        [Column(StringLength = 500)]
        public string GoodsSpecNames { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        [Column(StringLength = 200)]
        public string GoodsName { get; set; }

        /// <summary>
        /// 商品图
        /// </summary>
        [Column(StringLength = 200)]
        public string GoodsImg { get; set; }

        /// <summary>
        /// 商品佣金比率
        /// </summary>
        public decimal CommissionRate { get; set; }

        /// <summary>
        /// 额外信息
        /// </summary>
        [Column(StringLength = -2)]
        public string ExtraJson { get; set; }

        /// <summary>
        /// 商品类型
        /// 0:实物商品 
        /// 1:虚拟商品
        /// </summary>
        public int GoodsType { get; set; }

        /// <summary>
        /// 分销佣金
        /// </summary>
        public decimal Commission { get; set; }

        /// <summary>
        /// 商品标记 
        /// gift:赠品
        /// </summary>
        [Column(StringLength = 20)]
        public string GoodsCode { get; set; }

        /// <summary>
        /// 商品所参与的优惠活动json记录
        /// </summary>
        [Column(StringLength = -2)]
        public string PromotionJson { get; set; }

        /// <summary>
        /// 优惠券减免金额
        /// </summary>
        public decimal CouponVal { get; set; }

        /// <summary>
        /// 满减减免金额
        /// </summary>
        public decimal RewardVal { get; set; }

        /// <summary>
        /// 商品使用的积分	
        /// </summary>
        public int UseScoreVal { get; set; }

        /// <summary>
        /// 积分抵扣金额
        /// </summary>
        public decimal ScoreMoney { get; set; }

        /// <summary>
        /// 购买该商品获得的积分数
        /// </summary>
        public int GetScoreVal { get; set; }

        /// <summary>
        /// 获得的积分数可抵扣的金额
        /// </summary>
        public decimal GetScoreMoney { get; set; }

        /// <summary>
        /// 订单商品佣金
        /// </summary>
        public decimal OrderGoodscommission { get; set; }
    }
}
